﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace Cemit.NetFramework.Demo.Tutorial0
{
    /// <summary>
    /// 本教程会进行服务器连接的演示，并在text上显示连接成功或连接失败
    /// </summary>
    [System.Obsolete("该DEMO已过时")]
    public sealed class NetworkManager : MonoBehaviour
    {
        public Text text;

        void Start()
        {
            //设置监听
            PolyNetwork.OnConnectionSucceeded += () => text.text = "连接成功！";
            PolyNetwork.OnConnectionFailed += (t) => text.text = $"连接失败：{t}";

            //连接至服务器
            PolyNetwork.Connect("127.0.0.1", 2333);
        }
    }
}